class Comment < ActiveRecord::Base
  belongs_to :article, :counter_cache => true
  belongs_to :user  
  validates_length_of :body, :maximum => 1000
  
    def ispublished_authorized_for_update?
    current_user.has_role?('administrator')
  end
  
  def ispublished_authorized_for_create?
    current_user.has_role?('administrator')    
  end
  
    def ispublished_authorized_for_read?
    current_user.has_role?('administrator')    
  end
  
  def before_create
    self.user_id = current_user.id
  end
end
